.class public Lorg/microemu/app/util/RuntimeDetect;
.super Ljava/lang/Object;
.source "RuntimeDetect.java"


# static fields
.field private static inEclipseUnitTests:Z

.field private static java13:Z

.field private static java14:Z

.field private static java15:Z

.field private static runtimeDetected:Z


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    const/4 v0, 0x0

    .line 36
    sput-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java13:Z

    .line 38
    sput-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java14:Z

    .line 40
    sput-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java15:Z

    .line 42
    sput-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->inEclipseUnitTests:Z

    .line 44
    sput-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->runtimeDetected:Z

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 34
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method private static declared-synchronized detect()V
    .locals 2

    .prologue
    .line 47
    const-class v0, Lorg/microemu/app/util/RuntimeDetect;

    monitor-enter v0

    :try_start_0
    sget-boolean v1, Lorg/microemu/app/util/RuntimeDetect;->runtimeDetected:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v1, :cond_0

    .line 55
    :goto_0
    monitor-exit v0

    return-void

    .line 50
    :cond_0
    :try_start_1
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->detectJava14()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 51
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->detectJava15()Z

    .line 52
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->detectEclipse()V

    .line 54
    :cond_1
    const/4 v1, 0x1

    sput-boolean v1, Lorg/microemu/app/util/RuntimeDetect;->runtimeDetected:Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 47
    :catchall_0
    move-exception v1

    monitor-exit v0

    throw v1
.end method

.method private static detectEclipse()V
    .locals 5

    .prologue
    .line 80
    new-instance v3, Ljava/lang/Throwable;

    invoke-direct {v3}, Ljava/lang/Throwable;-><init>()V

    invoke-virtual {v3}, Ljava/lang/Throwable;->getStackTrace()[Ljava/lang/StackTraceElement;

    move-result-object v2

    .line 81
    .local v2, ste:[Ljava/lang/StackTraceElement;
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    array-length v3, v2

    if-ge v0, v3, :cond_0

    .line 82
    aget-object v1, v2, v0

    .line 83
    .local v1, s:Ljava/lang/StackTraceElement;
    invoke-virtual {v1}, Ljava/lang/StackTraceElement;->getClassName()Ljava/lang/String;

    move-result-object v3

    const-string v4, "org.eclipse.jdt"

    invoke-virtual {v3, v4}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_1

    .line 84
    const/4 v3, 0x1

    sput-boolean v3, Lorg/microemu/app/util/RuntimeDetect;->inEclipseUnitTests:Z

    .line 88
    .end local v1           #s:Ljava/lang/StackTraceElement;
    :cond_0
    return-void

    .line 81
    .restart local v1       #s:Ljava/lang/StackTraceElement;
    :cond_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method private static declared-synchronized detectJava14()Z
    .locals 2

    .prologue
    .line 59
    const-class v0, Lorg/microemu/app/util/RuntimeDetect;

    monitor-enter v0

    :try_start_0
    const-string v1, "java.lang.StackTraceElement"

    invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    .line 60
    const/4 v1, 0x1

    sput-boolean v1, Lorg/microemu/app/util/RuntimeDetect;->java14:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    .line 63
    :goto_0
    :try_start_1
    sget-boolean v1, Lorg/microemu/app/util/RuntimeDetect;->java14:Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    monitor-exit v0

    return v1

    .line 59
    :catchall_0
    move-exception v1

    monitor-exit v0

    throw v1

    .line 61
    :catch_0
    move-exception v1

    goto :goto_0
.end method

.method private static detectJava15()Z
    .locals 1

    .prologue
    .line 68
    :try_start_0
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->java5Function()Z

    .line 69
    const/4 v0, 0x1

    sput-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java15:Z
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    .line 72
    :goto_0
    sget-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java15:Z

    return v0

    .line 70
    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public static isInEclipseUnitTests()Z
    .locals 1

    .prologue
    .line 106
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->detect()V

    .line 107
    sget-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->inEclipseUnitTests:Z

    return v0
.end method

.method public static isJava13()Z
    .locals 1

    .prologue
    .line 91
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->detect()V

    .line 92
    sget-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java13:Z

    return v0
.end method

.method public static isJava14()Z
    .locals 1

    .prologue
    .line 96
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->detect()V

    .line 97
    sget-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java14:Z

    return v0
.end method

.method public static isJava15()Z
    .locals 1

    .prologue
    .line 101
    invoke-static {}, Lorg/microemu/app/util/RuntimeDetect;->detect()V

    .line 102
    sget-boolean v0, Lorg/microemu/app/util/RuntimeDetect;->java15:Z

    return v0
.end method

.method private static java5Function()Z
    .locals 1

    .prologue
    .line 76
    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Thread;->getStackTrace()[Ljava/lang/StackTraceElement;

    move-result-object v0

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method
